package com.fzy.core;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

import org.apache.log4j.Logger;
import org.springframework.web.context.ContextLoaderServlet;

public class MyContextLoaderServlet extends ContextLoaderServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	protected static final Logger log = Logger.getLogger(MyContextLoaderServlet.class);

	public void init() throws ServletException {
        super.init();
        setupContext(getServletContext());
    }
    
    public static void setupContext(ServletContext context) {
//		ApplicationContext ctx = WebApplicationContextUtils
//				.getRequiredWebApplicationContext(context);
//		SessionFactory sessionFactory = (SessionFactory)ctx.getBean("sessionFactory");
//		Session session = sessionFactory.openSession();
//		Transaction tx = session.beginTransaction();
//
//		
//		tx.commit();
		
		log.info("<=========== String context initialization is completed.");

	}
}
